
import javax.swing.text.StyledEditorKit;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

/**
 * Created by losor on 2017/2/27.
 */
public class _500_KeyboardRow {

    public static void main(String[] args) {
    }

    public String[] findWords(String[] words) {
        List<String> slist = new ArrayList<>();
        for (String s:words
             ) {
            if(isinRow(s)){
                slist.add(s);
            }
        }
        String[] out = new String[slist.size()];
        for (int i = 0; i < slist.size(); i++) {
            out[i] = slist.get(i);
        }
        return out;
    }

    public static boolean isinRow(String s){
        if (s.replaceAll("[qwertyuiopQWERTYUIOP]","").isEmpty()){
            return true;
        }
        else if (s.replaceAll("[asdfghjklASDFGHJKL]","").isEmpty()){
            return true;
        }
        else if(s.replaceAll("[zxcvbnmZXCVBNM]","").isEmpty()){
            return true;
        }
        return false;
    }
}
